<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Hello world, SpringMVC</title>
<script type="text/javascript" src="<%=request.getContextPath()%>/assets/jquery.js"></script>
</head>
<body>
	<h1>Hello world, SpringMVC!</h1>
	<h2>msg: ${msg}</h2>
	<h2>id: <span id="xxxx"></span></h2>
	
	<button type="button" onclick="callAjax();">Call Ajax</button>
</body>
<script type="text/javascript">
	function callAjax() {
		$.ajax({
			type: 'GET',
			url: '<%=request.getContextPath()%>/demo/ajax',
			success: function(res) {
				///document.getElementById('xxxx').innerHTML = res;
				$('#xxxx').html(res);
			},
			error: function(){
				alert('error ajax call');
			}
		});
	}
	
	setInterval(callAjax, 1000);
</script>
</html>